<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
    *{margin: 0;padding: 0;}
    .is-fx{
        position: fixed;
        right: 0;
        bottom: 50px;
        width: 150px;
        height: 150px;
        background: aquamarine;
        text-align: center;
        line-height: 150px;
    }
    </style>
</head>
<body style="height: 5000px;">
<div id="isFx" class="is-fx">回到顶部</div> 
<script>
var isFx=document.getElementById('isFx');
isFx.onclick=function(){
    document.documentElement.scrollTop=0;
}
</script>   
</body>
</html>